import { getToken } from "../../utils/token"

const initialState = { token: getToken() || "", refresh_token: "" }
export default function loginReducer(state = initialState, active) {
  switch (active.type) {
    case "SET_TOKEN":
      return {
        ...state,
        token: active.payload
      }
    case "CLEAR_TOKEN":
      return initialState
    default:
      return state
  }
}
